﻿CREATE FUNCTION dbo.VariantDiff
(
	@Param1 sql_variant,
	@Param2 sql_variant
)
RETURNS bit
AS
BEGIN
	IF @Param1 IS NULL AND @Param2 IS NULL RETURN 0

	IF @Param1 IS NULL AND @Param2 IS NOT NULL RETURN 1

	IF @Param1 IS NOT NULL AND @Param2 IS NULL RETURN 1

	IF Sql_Variant_Property( @Param1, 'BaseType') <> Sql_Variant_Property( @Param2, 'BaseType')
		RETURN 1

	IF @Param1 <> @Param2 RETURN 1

	RETURN 0
END
